$(function () {
    $("#latent_datagrid").datagrid({
        url:'/clientTransfer/query.do',
        fit:true,
        toolbar:'#latent_toolbar',
        fitColumns:true,
        rownumbers:true,
        pagination: true,
        pageSize: 10,
        pageNumber: 1,
        columns:[[
            {field:'transTime',title:'移交日期',width:100,align:'center'},

            {field:'transUser',title:'操作人',width:100,align:'center',formatter: function(value,row,index) {
                return value?value.realname:""
            }
            },
            {field:'latentClient',title:'客户',width:100,align:'center',formatter: function(value,row,index) {
                return value?value.name:""
            }
            },
            {field:'oldSeller',title:'原市场专员',width:100,align:'center',formatter: function(value,row,index) {
                return value?value.realname:""
            }
            },
            {field:'newSeller',title:'现市场专员',width:100,align:'center',formatter: function(value,row,index) {
                return value?value.realname:""
            }
            },
            {field:'transReason',title:'移交原因',width:100,align:'center'},

        ]],

    });

    var methodObject = {


        reload: function () {
            $("#latent_datagrid").datagrid('load')
        },

        searchForm:function () {
            //获取输入的值
            var startTime = $("[name=startTime]").val();
            var endTime = $("[name=endTime]").val();
            var clientName=$("[name=clientName]").val();
            var transUserRealName=$("[name=transUserRealName]").val();
            var oldSellerRealName=$("[name=oldSellerRealName]").val();
            var newSellerRealName=$("[name=newSellerRealName]").val();
            $("#latent_datagrid").datagrid('load',{
                startTime:startTime,
                endTime:endTime,
                clientName:clientName,
                transUserRealName:transUserRealName,
                oldSellerRealName:oldSellerRealName,
                newSellerRealName:newSellerRealName
            });
        },
    }
    //所用的点击事件，都通过这个方法来调用对应的方法
    $("a[data-cmd]").click(function () {
        var cmd = $(this).data("cmd");
        methodObject[cmd]();
    });
});